#ifndef EXTOSCTHREAD_H
#define EXTOSCTHREAD_H

#include <QThread>
#include "ip/UdpSocket.h"
#include "osc/OscOutboundPacketStream.h"
#include "MutaPacketListener.h"
#include <QPointF>
#include "ControlPoint.h"


class ExtOSCThread : public QThread
{
    Q_OBJECT
public:
    ExtOSCThread(int port);

    void run();
    UdpReceiveSocket* getReceiveSocket();
    void quitConnection();
    void login();
    MutaPacketListener* getListener();

private:
    UdpReceiveSocket* receiveSocket;
    SocketReceiveMultiplexer mux;
    MutaPacketListener* listener;
    int seqSendPort;

public slots:
    //Sequencing
    void send(QString address, int port, osc::OutboundPacketStream p);
    void attack(QString id, QString type, float val);
    void sustain(QString id, QString type, float val);
    void release(QString id, QString type, float val);

    //OSCthulhu
    void addEvent(float x, float y, int layer, float length);
    void addLine(QString type,float x, float y, int layer);
    void removeObject(QString objectID);
    void setSyncArg(QString objectID,int argNum,QString value);
    void setSyncArg(QString objectID,int argNum,int value);
    void setSyncArg(QString objectID,int argNum,float value);
    void controlPointAdded(QString objectID,QString controlPointString);
    void addUserCursor();


    //general
    void posChange(QString objectID,const QPointF& point);
    void changeSendPort(int sendPort);
};

#endif // EXTOSCTHREAD_H
